package com.neusoft.databus.core.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.netflix.discovery.EurekaClient;
import com.netflix.discovery.shared.Application;
import com.neusoft.databus.common.constant.DatabusConstant;
import com.neusoft.databus.core.service.JobExecutableDetermineService;

@Service
public class JobExecutableDetermineServiceImpl implements JobExecutableDetermineService {

    @Autowired
    private EurekaClient eurekaClient;

    @Override
    public boolean canExecute() {
        final Application agentApp = this.eurekaClient.getApplication(DatabusConstant.MICRO_SERVICE_NAME_AGENT);
        return null != agentApp;
    }

}
